''' Mission 9 Remix 3B Includes a beep for each arrow (list created, although can be done with a variable instead, like the index) Uses half the delay for beep and half for waiting OPTIONAL: Also includes a pixel lighting up for each arrow Use button D to end game ''' from codex import * import random from time import sleep my_tones = [400, 450, 500, 550, 600, 650, 700, 750] my_pixels = [0, 1, 2, 3, 0, 1, 2, 3] my_colors = [RED, BLUE, GREEN, YELLOW, PURPLE, WHITE, PINK, CYAN] def show_random_arrow(): index = random.randrange(8) display.show(pics.ALL_ARROWS[index]) pixels.set(my_pixels[index], my_colors[index]) def spin_animation(count): index = 0 loops = 0 delay = 0.0 while loops < count: loops = loops + 1 display.show(pics.ALL_ARROWS[index]) pixels.set(my_pixels[index], my_colors[index]) audio.pitch(my_tones[index], delay/2) sleep(delay/2) pixels.set([BLACK, BLACK, BLACK, BLACK]) delay = delay + 0.005 index = index + 1 if index == 8: index = 0 # Main Program while True: if buttons.is_pressed(BTN_A) or buttons.is_pressed(BTN_B): spin_animation(20) show_random_arrow() if buttons.is_pressed(BTN_D): break display.clear() display.print("Thanks",scale=4)